//
//  iTunesNode.m
//  iTunes Playlist Selector
//
//  Created by Keith Duncan on 22/05/2007.
//  Copyright 2007 thirty-three. All rights reserved.
//

#import "iTunesNode.h"

@implementation iTunesNode

- (NSImage *)image {
	NSDictionary *currentPlaylist = [self representedObject];
	
	NSInteger kind = NSNotFound;
	id kindObject = [currentPlaylist objectForKey:@"Distinguished Kind"];
	if (kindObject != nil) kind = [kindObject integerValue];
	
	NSString *imageName = nil;
	switch (kind) {
		case /* Music */ 4:
			imageName = @"Music";
			break;
		case /* Movies */ 2:
			imageName = @"Movies";
			break;
		case /* TV Shows */ 3:
			imageName = @"TV Shows";
			break;
		case /* Podcasts */ 10:
			imageName = @"Podcasts";
			break;
		case /* AudioBooks*/ 5:
			imageName = @"Audiobooks";
			break;
		case /* Purchased */ 19:
		case /* Purchased on [...] */ 20:
			imageName = @"Purchased Playlist";
			break;
		case /* Party Shuffle */ 22:
			imageName = @"Party Shuffle";
			break;
		default:
			switch (self.type) {
				case kiTunesFolder:
					imageName = @"Folder";
					break;
				case kiTunesSmartPlaylist:
					imageName = @"Smart Playlist";
					break;
				case kiTunesPodcast:
					imageName = @"Podcasts";
					break;
				default :
					imageName = @"Playlist";
					break;
			}
			
			break;
	}
	
	return [NSImage imageNamed:imageName];
}

@end
